1. Migrating Printers with printbrm
You can migrate printers from one print server to another print server with the printbrm.exe
tool. The tool is located in the c:\windows\system32\spool\tools
folder. This tool can be used to back up, restore, and migrate printer
information.
Note
Because this path is not known to Windows by default,
you either need to include the path in the command or change the
directory before executing the command. For example, you can change to
the directory with the command cd \windows\system32\spool\tools.
The switches you use are listed in the following table.
Note
Because printbrm.exe is an executable file (not a script like pubprn.vbs), the cscript command is not needed.
printbrm Switches | Comments |
---|
Target server.
-s \\server-name
-s \\dc1
| The -s identifies the server that holds the printer information. |
File name.
-f file-name.printerexport
-f printers.printerexport
| You can name the file whatever you want, but the extension must be printerexport. |
Backup printer information.
-b
printbrm -s \\source-computername
-b -f file-name.printerexport
C:\>c:\windows\system32\spool\
tools\printbrm -s \\dc2 -b -f
printers.printerexport
| Backs up the printer information to a file.
The example command retrieves the printer information from DC2 and stores it in a file named printers.printerexport. |
Query the file.
-q
printbrm -q -f
filename.printerexport
C:\>c:\windows\system32\spool\
tools\printbrm -q -f
printers.printerexport
| You can query the contents of the file with the -q switch. It displays a listing of print queues, printer drivers, printer ports, and print processes contained in the file. |
Restore printer information.
-r
printbrm -s \\target-computer-r
-f filename.printerexport
C:\>c:\windows\system32\spool\
tools\printbrm -s \\dc1 -r -f
printers.printerexport
| Restores the configuration information from the file to a server.
The example reads the data from the file named printers.printerexport and restores it on the server named DC1. |
The following steps show how to migrate printers from
one print server (named DC2) to another print server (DC1). You can
execute both commands on either DC1 or DC2.
Step | Action |
---|
1. | Back up the printers stored on the source computer (DC2) to a file named dc2printers.printerexport with this command:
C:\>c:\windows\system32\spool\tools\printbrm -s \\dc2 -b -f
dc2printers.printerexport
|
2. | Migrate the printers to the target computer with the following command:
C:\>c:\windows\system32\spool\tools\printbrm -s \\dc1 -r -f
dc2printers.printerexport |
2. Controlling the Print Queue with prnqctl.vbs
The prnqctl.vbs
script can be used to control the print queue on local and remote
computers. The script is located in the
c:\windows\system32\printing_admin_scripts\en-us folder. You can use it
to pause printing, resume printing, cancel all printing, and print a
test page. The basic syntax is as follows:
cscript prnqctl.vbs option -p printer-name
[-s remote-computer] [-u user-name -w password]
Tip
The printer-name is the actual name of the printer, not the share name.
The following table shows some uses of this script.
Note
In the following table, the path was changed to the location of the prnqctl.vbs script with the following command:
cd \Windows\System32\Printing_Admin_Scripts\en-US.
prnqctl Command | Comments |
---|
Pause printing.
-z
C:\Windows\System32\Printing_
Admin_Scripts\en-US>cscript
prnqctl.vbs -z -p "HP Officejet
5600 series"
C:\Windows\System32\Printing_
Admin_Scripts\en-US>cscript
prnqctl.vbs -z -s dc2 -p "HP
Officejet 5600 series"
| The -z switch causes the printer to pause.
In the first example, the local printer named HP
Officejet 5600 series is paused. Because the printer name has spaces in
it, it must be enclosed in quotes. Figure 1 shows the result after executing this command. The printer is paused.
The second example pauses the printer on a server named dc2.
Note
When using the -s switch to connect to a remote computer, the user’s credentials are used. If the user doesn’t have permissions, the -u and -w switches must be used to add a username and password.
|
Add a username and password.
-uusername -wpassword
C:\Windows\System32\Printing_
Admin_Scripts\en-US>cscript
prnqctl.vbs -z -s dc2 - p "HP
Officejet 5600 series" -u
pearson\administrator -w P@ssw0rd
| This example pauses the printer on the remote system named dc2 using different credentials. |
Resume printing.
-m
C:\Windows\System32\Printing_
Admin_Scripts\en-US>cscript
prnqctl.vbs -m -p "HP Officejet
5600 series"
C:\Windows\System32\Printing_
Admin_Scripts\en-US>cscript
prnqctl.vbs -m -s dc2 -p "HP
Officejet 5600 series"
| The -m switch resumes the printer.
The first example resumes the local printer. The second example resumes the printer on a remote server named dc2. |
Cancel all printing.
-x
C:\Windows\System32\Printing_
Admin_Scripts\en-US>cscript
prnqctl.vbs -x -p "HP Officejet
5600 series"
C:\Windows\System32\Printing_
Admin_Scripts\en-US>cscript
prnqctl.vbs -x -s dc2 -p "HP
Officejet 5600 series"
| The -x switch cancels all print jobs spooled to the printer.
The first example resumes the local printer. The second example resumes the printer on a remote server named dc2. |
Print a test page.
-e
C:\Windows\System32\Printing_
Admin_Scripts\en-US>cscript
prnqctl.vbs -e -p "HP Officejet
5600 series"
C:\Windows\System32\Printing_
Admin_Scripts\en-US>cscript
prnqctl.vbs -e -s dc2 -p "HP
Officejet 5600 series"
| You can send a test page to the printer with the -e switch.
The first example resumes the local printer. The second example resumes the printer on a remote server named dc2. |